home *** CD-ROM | disk | FTP | other *** search
/ Trusted Irix /B 4.0.4 / Trusted-Irix B-4.0.1.iso / dist / eoe1.idb / usr / include / sys / softfp.h.z / softfp.h
Text File  |  1992-04-03  |  5KB  |  211 lines

  1. /* $Revision: 3.9 $ */
  2. /* ------------------------------------------------------------------ */
  3. /* | Copyright Unpublished, MIPS Computer Systems, Inc.  All Rights | */
  4. /* | Reserved.  This software contains proprietary and confidential | */
  5. /* | information of MIPS and its suppliers.  Use, disclosure or     | */
  6. /* | reproduction is prohibited without the prior express written   | */
  7. /* | consent of MIPS.                                               | */
  8. /* ------------------------------------------------------------------ */
  9.  
  10. /*
  11.  * softfp.h -- constants for software floating point emulation
  12.  */
  13.  
  14. /*
  15.  * The _MASK's are used to get a the specified field after it has been
  16.  * shifted by _SHIFT and then bit patterns (like _COPN) can be used to test
  17.  * the field.
  18.  */
  19. /* constants for the OPCODE field for some general instructions */
  20. #define    OPCODE_SHIFT    26
  21. #define    OPCODE_MASK    0x3f
  22. #define    OPCODE_SPECIAL    0x00
  23. #define    OPCODE_BCOND    0x01
  24. #define    OPCODE_J    0x02
  25. #define    OPCODE_JAL    0x03
  26. #define    OPCODE_BEQ    0x04
  27. #define    OPCODE_C1    0x11
  28.  
  29. /* constants for the emulating jump or jump and link instructions */
  30. #define    TARGET_MASK    0x03ffffff
  31. #define    PC_JMP_MASK    0xf0000000
  32.  
  33. /* constants for the FUNC field for some general instructions */
  34. #define    FUNC_MASK    0x3f
  35. #define    FUNC_JR        0x08
  36. #define    FUNC_JALR    0x09
  37.  
  38. /*
  39.  * constants for the OPCODE field for detecting all general branch
  40.  * (beq,bne,blez,bgtz) instructions and all coprocessor instructions.
  41.  */
  42. #define    BRANCH_MASK    0x3c
  43. #define    OPCODE_BRANCHES    0x04
  44. #define    COPN_MASK    0x3c
  45. #define    OPCODE_COPN    0x10
  46.  
  47. /* constants for load/store COPN instructions */
  48. #define    OP_LSWCOPNMASK    0x37
  49. #define    OP_LSWCOPN    0x31
  50. #define OP_LSBITMASK    0x8
  51. #define OP_LBIT        0x0
  52.  
  53. /* constants for branch on COPN condition instructions */
  54. #define    COPN_BCSHIFT    24
  55. #define    COPN_BCMASK    0x3
  56. #define    COPN_BC        0x1
  57. #define    BC_TFBITSHIFT    16
  58. #define    BC_TFBITMASK    0x1
  59. #define BC_FBIT        0x0
  60.  
  61. /* constants for move to/from COPN instructions */
  62. #define    COPN_MTFSHIFT    25
  63. #define    COPN_MTFMASK    0x1
  64. #define    COPN_MTF    0x0
  65. #define    COPN_MTFBITSHIFT    23
  66. #define    COPN_MTFBITMASK    0x1
  67. #define COPN_MFBIT    0x0
  68.  
  69. /* constants for move control registers to/from CP1 instructions */
  70. #define M_CONBITSHIFT    22
  71. #define    M_CONBITMASK    0x1
  72.  
  73. #define FPR_REV        0
  74. #define FPR_EIR        30
  75. #define FPR_CSR        31
  76. #define    SOFTFP_REVWORD    0x0
  77.  
  78. /*
  79.  * These constants refer to the fields of coprocessor instructions not
  80.  * cpu instructions (ie the RS and RD fields are different).
  81.  */
  82. #define BASE_SHIFT    21
  83. #define BASE_MASK    0x1f
  84. #define RT_SHIFT    16
  85. #define    RT_MASK        0x1f
  86. #define    RT_FPRMASK    0x1e
  87. #define RS_SHIFT    11
  88. #define    RS_MASK        0x1f
  89. #define    RS_FPRMASK    0x1e
  90. #define RD_SHIFT    6
  91. #define    RD_MASK        0x1f
  92. #define    RD_FPRMASK    0x1e
  93.  
  94. #define IMMED_SHIFT    16
  95.  
  96. #define C1_FMT_SHIFT    21
  97. #define    C1_FMT_MASK    0xf
  98. #define C1_FMT_SINGLE    0
  99. #define C1_FMT_DOUBLE    1
  100. #define C1_FMT_EXTENDED    2
  101. #define C1_FMT_QUAD    3
  102. #define C1_FMT_WORD    4
  103. #define C1_FMT_MAX    4
  104.  
  105. #define C1_FUNC_MASK    0x3f
  106. #define C1_FUNC_DIV    3
  107. #define C1_FUNC_NEG    7
  108. #define C1_FUNC_ROUND    12
  109. #define C1_FUNC_FLOOR    15
  110. #define C1_FUNC_CVTS    32
  111. #define C1_FUNC_CVTW    36
  112. #define C1_FUNC_1stCMP    48
  113.  
  114. #define COND_UN_MASK    0x1
  115. #define COND_EQ_MASK    0x2
  116. #define COND_LT_MASK    0x4
  117. #define COND_IN_MASK    0x8
  118.  
  119. /*
  120.  * These constants refer to fields in the floating-point status and control
  121.  * register.
  122.  */
  123. #define    CSR_CBITSHIFT    23
  124. #define    CSR_CBITMASK    0x1
  125. #define    CSR_CBITSET    0x00800000
  126. #define    CSR_CBITCLEAR    0xff7fffff
  127.  
  128. #define    CSR_FSBITSET    0x01000000
  129. #define    UNDERFLOW_CAUSE    0x00002000
  130. #define    UNDERFLOW_FLAG    0x00000008
  131.  
  132. #define    CSR_EXCEPT    0x0003f000
  133. #define    UNIMP_EXC    0x00020000
  134. #define    INVALID_EXC    0x00010040
  135. #define    DIVIDE0_EXC    0x00008020
  136. #define    OVERFLOW_EXC    0x00004010
  137. #define    UNDERFLOW_EXC    0x00002008
  138. #define    INEXACT_EXC    0x00001004
  139.  
  140. #define CSR_ENABLE        0x00000f80
  141. #define    INVALID_ENABLE        0x00000800
  142. #define    DIVIDE0_ENABLE        0x00000400
  143. #define    OVERFLOW_ENABLE        0x00000200
  144. #define    UNDERFLOW_ENABLE    0x00000100
  145. #define    INEXACT_ENABLE        0x00000080
  146.  
  147. #define    CSR_RM_MASK    0x3
  148. #define    CSR_RM_RN    0
  149. #define    CSR_RM_RZ    1
  150. #define    CSR_RM_RPI    2
  151. #define    CSR_RM_RMI    3
  152.  
  153. /*
  154.  * These constants refer to floating-point values for all formats
  155.  */
  156. #define    SIGNBIT        0x80000000
  157.  
  158. #define    GUARDBIT    0x80000000
  159. #define    STKBIT        0x20000000
  160.  
  161. /*
  162.  * These constants refer to word values
  163.  */
  164. #define    WORD_MIN    0x80000000
  165. #define    WORD_MAX    0x7fffffff
  166. #define    WEXP_MIN    -1
  167. #define    WEXP_MAX    30
  168. #define    WQUIETNAN_LEAST    0x7fffffff
  169.  
  170. /*
  171.  * These constants refer to single format floating-point values
  172.  */
  173. #define    SEXP_SHIFT    23
  174. #define    SEXP_MASK    0xff
  175. #define    SEXP_NAN    0xff
  176. #define    SEXP_INF    0xff
  177. #define    SEXP_BIAS    127
  178. #define    SEXP_MAX    127
  179. #define    SEXP_MIN    -126
  180. #define    SEXP_OU_ADJ    192
  181. #define    SIMP_1BIT    0x00800000
  182. #define    SFRAC_LEAD0S    8
  183. #define    SFRAC_BITS    23
  184. #define    SFRAC_MASK    0x007fffff
  185. #define    SFRAC_LEAST_MAX    0x007fffff
  186.  
  187. #define    SSNANBIT_MASK    0x00400000
  188. #define    SQUIETNAN_LEAST    0x7fbfffff
  189.  
  190. /*
  191.  * These constants refer to double format floating-point values
  192.  */
  193. #define    DEXP_SHIFT    20
  194. #define    DEXP_MASK    0x7ff
  195. #define    DEXP_NAN    0x7ff
  196. #define    DEXP_INF    0x7ff
  197. #define    DEXP_BIAS    1023
  198. #define    DEXP_MAX    1023
  199. #define    DEXP_MIN    -1022
  200. #define    DEXP_OU_ADJ    1536
  201. #define    DIMP_1BIT    0x00100000
  202. #define    DFRAC_LEAD0S    11
  203. #define    DFRAC_BITS    52
  204. #define    DFRAC_MASK    0x000fffff
  205. #define    DFRAC_LESS_MAX    0x000fffff
  206. #define    DFRAC_LEAST_MAX    0xffffffff
  207.  
  208. #define    DSNANBIT_MASK    0x00080000
  209. #define    DQUIETNAN_LESS    0x7ff7ffff
  210. #define    DQUIETNAN_LEAST    0xffffffff
  211.